package aiku.numericalcontroloa.Controller.Work;

import aiku.numericalcontroloa.Base.Utils.Result;
import aiku.numericalcontroloa.Service.Impl.UserScoreServiceImpl;
import aiku.numericalcontroloa.Service.UserScoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 马文杰
 * @version 1.0
 */
@RestController
@RequestMapping("/userScore")
public class UserScoreController {
    @Autowired
    private UserScoreServiceImpl userScoreService;
    /**
     * 通过用户id给用户评分,也可以给自己评分
     */
    @RequestMapping("/addUserScore")
    public Result addUserScore(@RequestParam("userId") String userId, @RequestParam("score") Integer score){
        return userScoreService.addUserScore(userId,score);
    }

    /**
     * 统计用户平均分
     */
    @RequestMapping("/selectUserScoreList")
    public Result selectUserScoreList(@RequestParam("day") Integer day){
        return userScoreService.selectUserScoreList(day);
    }

}
